package com.lc202407;

import java.util.ArrayList;
import java.util.List;

public class Solution796 {
    public static boolean rotateString(String s, String goal) {
        int length = s.length();
        int length1 = goal.length();
        if (length != length1) {
            return false;
        }
        List<Integer> arr = new ArrayList<>();
        for (int j = 0; j < length; j++) {
            if (s.charAt(0) == goal.charAt(j)) {
                arr.add(j);
            }
        }

        for (Integer index : arr) {
            for (int i = 0; i < length; i++) {
                if (s.charAt(i) != goal.charAt((i + index) % length)) {
                    break;
                }
                if (i == length - 1) {
                    return true;
                }
            }
        }
        return false;

    }

    public static void main(String[] args) {
        rotateString("ohbrwzxvxe", "uornhegseo");
    }
}
